import java.util.Scanner;

public class shuxianhuashu  {


    shuxianhuashu() {
            Scanner scanner = new Scanner(System.in);
            int n = scanner.nextInt();
            for (int i = (int) Math.pow(10, n - 1); i < Math.pow(10, n); i++) {
                int sum = 0;
                int temp = i;
                while (temp > 0) {
                    sum += Math.pow(temp % 10, n);
                    temp /= 10;
                }
                if (sum == i) {
                    System.out.println(i);
                }
            }



        }
}
